package com.news.gpb.controller;

import com.news.gpb.entity.Comment;
import com.news.gpb.entity.User;
import com.news.gpb.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin("http://localhost:8080")
@RestController
public class CommentController {

    @Autowired
    CommentService commentService;

    @RequestMapping("/addComment")
    String addComment(@RequestBody Comment comment)
    {
        return commentService.addComment(comment);
    }

    @RequestMapping("/getComment")
    List<Comment> getComment(@RequestBody Comment comment)
    {
        return commentService.getComment(comment);
    }

    @RequestMapping("/getPicture")
    List<User> getPicture(@RequestBody Comment comment)
    {
        return commentService.getPicture(comment);
    }
}
